package com.mce.nebula.entity;

import com.mce.nebula.common.BaseEntity;
import jakarta.persistence.*;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;

/**
 * 登录事件实体，对应Python的LoginEvent模型
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Entity
@Table(name = "login_events")
public class LoginEvent extends BaseEntity {
    
    @Column(name = "event_id", length = 32, nullable = false)
    private String eventId;
    
    @Column(name = "enterprise_id", length = 32, nullable = false)
    private String enterpriseId;
    
    @Column(name = "username", length = 64, nullable = false)
    private String username;
    
    @Column(name = "login_time")
    private LocalDateTime loginTime;
    
    @Column(name = "last_active_time")
    private LocalDateTime lastActiveTime;
    
    @Column(name = "logout_time")
    private LocalDateTime logoutTime;
    
    @Column(name = "duration")
    private Integer duration; // 持续时间(毫秒)
    
    @Column(name = "client_ip", length = 255, nullable = false)
    private String clientIp;
    
    @Column(name = "ip_locale_main", length = 255)
    private String ipLocaleMain;
    
    @Column(name = "user_agent", length = 255, nullable = false)
    private String userAgent;
}